//
//  HYHomeTitleButton.swift
//  iOSWeibo
//
//  Created by why on 16/7/24.
//  Copyright © 2016年 王浩宇. All rights reserved.
//

import UIKit

class HYHomeTitleButton: UIButton {
    convenience init(title: String) {
        self.init(frame: CGRectZero)
        
        self.setTitle(title, forState: UIControlState.Normal)
        self.setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
        self.setImage(UIImage(named: "navigationbar_arrow_down"), forState: UIControlState.Normal)
        self.sizeToFit()
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        //1.将文字移动最左边
        self.titleLabel?.frame.origin.x = 0
        //2.将图片的x值
        self.imageView?.frame.origin.x = self.titleLabel!.frame.width + 4
    }
}
